//
//  IManager+Balance.m
//  RocketProject
//
//  Created by chen jiedan on 13-7-2.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+Balance.h"
#import "RequestUtlity.h"
#import "FrameworkRelativeDefines.h"
#import "RCLoginDataModel.h"

@implementation IManager (Balance)


-(int64_t)requestBlance:(NSString *)bduss  withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == bduss) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *urlPrefix = [NSString stringWithFormat:kRCUserBalancePrefix,bduss];
    NSString *url = [RequestUtlity getFormattedUrl:urlPrefix];
    
    KFLog(@"request url %@",url);
//    NSDictionary *postDic = @{@"bduss": bduss};
//    NSDictionary *userInfo =@{@"PostDataValue": postDic};
    
//    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"BalanceJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
//   return  [[IDataProvider sharedInstance] asyncPostData:url postValues:postDic postDataList:nil userInfo:nil withDataParseClass:[RCBalanceDataModel class] withDataDelegate:delegate];
    
    
    
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCBalanceDataModel class]
                                                     withDataDelegate:delegate];
    
}


-(int64_t)requestCostDetail:(NSString *)bduss forPage:(NSString *)page withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == bduss) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *urlPrefix = [NSString stringWithFormat:kRCUserConsumptionPrefix,bduss,0,10];

    NSString *url = [RequestUtlity getFormattedUrl:urlPrefix];
    
    KFLog(@"request url %@",url);
//    NSDictionary *postDic = @{@"bduss": bduss,@"pn":@"0",@"rn":@"10"};

    //    NSDictionary *userInfo =@{@"PostDataValue": postDic};
    
//    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"CostDetail"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCCostListDataModel class]
                                                     withDataDelegate:delegate];
    
//    return  [[IDataProvider sharedInstance] asyncPostData:url postValues:postDic postDataList:nil userInfo:nil withDataParseClass:[RCCostListDataModel class] withDataDelegate:delegate];

    
}

@end
